package com.dataStore.business.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.dataStore.business.dao.StoreTestMapper;
import com.dataStore.business.mapper.StoreTestDao;
import com.dataStore.domain.StoreTestBean;

import tk.mybatis.mapper.entity.Example;


@RestController
public class StoreTestController {
	
	@Autowired
	private StoreTestMapper storeTestMapper;
	@Autowired
	private StoreTestDao  storeTestDao;
	
	@SuppressWarnings("deprecation")
	@GetMapping("zhaoyan1")
	public ResponseEntity<String> zhaoyan1(){
		Example example = new Example(StoreTestBean.class);
		example.createCriteria().andIsNotNull("id");
		List<StoreTestBean> selectByExample = storeTestMapper.selectByExample(example);
		if(selectByExample!=null && selectByExample.size()>0){
			for (StoreTestBean storeTestBean : selectByExample) {
				System.out.println(storeTestBean.getCreateDate().toLocaleString());
			}
		}
		return ResponseEntity.ok(String.valueOf(storeTestMapper.countNumbers()));
	}
	
	@SuppressWarnings("deprecation")
	@GetMapping("zhaoyan2")
	public ResponseEntity<String> zhaoyan2(){
		Example example = new Example(StoreTestBean.class);
		example.createCriteria().andIsNotNull("id");
		List<StoreTestBean> selectByExample = storeTestDao.selectByExample(example);
		if(selectByExample!=null && selectByExample.size()>0){
			for (StoreTestBean storeTestBean : selectByExample) {
				System.out.println(storeTestBean.getCreateDate().toLocaleString());
			}
		}
		return ResponseEntity.ok(String.valueOf(storeTestDao.countNumbers()));
	}

}
